package com.sheepone.util.business;


import java.util.ArrayList;
import java.util.List;

/**
 * @author Miss.杨
 * @description 曲线信息
 * @since 2024/3/22 - 16:58
 */
public class CurveInfo<T> {

    /**
     * 曲线id
     */
    String curveId;
    /**
     * 曲线名称
     */
    String curveName;
    /**
     * 曲线单位
     */
    String curveUnit;
    /**
     * 曲线数据点
     */
    List<DataAndTime<Double, T>> dataPoints = new ArrayList<>();

    public CurveInfo(String curveId, String curveName, String curveUnit) {
        this.curveId = curveId;
        this.curveName = curveName;
        this.curveUnit = curveUnit;
    }

    public void addPoint(DataAndTime<Double, T> dataPoint) {
        this.dataPoints.add(dataPoint);
    }

    public void addPoints(List<DataAndTime<Double, T>> dataPoints) {
        if (dataPoints != null && !dataPoints.isEmpty()) {
            this.dataPoints.addAll(dataPoints);
        }
    }

    public void addPoint(Double data, T time) {
        this.dataPoints.add(new DataAndTime<>(data, time));
    }

    public String getCurveId() {
        return curveId;
    }

    public void setCurveId(String curveId) {
        this.curveId = curveId;
    }

    public String getCurveName() {
        return curveName;
    }

    public void setCurveName(String curveName) {
        this.curveName = curveName;
    }

    public String getCurveUnit() {
        return curveUnit;
    }

    public void setCurveUnit(String curveUnit) {
        this.curveUnit = curveUnit;
    }
}
